package xyz.eden.boot.core.tool;

import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

/**
 * AssertTool
 *
 * @author gavin
 * @version 1.0
 * @descriptor
 * @date 2023/4/29 22:30
 */
public class AssertTool {

    public static void isTrue(Boolean bool, Exception e) throws Exception {
        if (!Objects.equals(bool, true)) {
            throw e;
        }
    }

    public static void isNotBlank(String str, Exception e) throws Exception {
        if (StringUtils.isBlank(str)) {
            throw e;
        }
    }

    public static void notNull(Object obj, Exception e) throws Exception {
        if (Objects.isNull(obj)) {
            throw e;
        }
    }
}
